package example1;

import hmm.MarkovianProbabilities;

/**
 * 2 states:
 * s1 - like H. p(s1|s1) = .6; p(H) = .6
 * s2 - very like T. p(s2|s2) = .8; p(T) = .9
 */
public class ProbEx1 implements MarkovianProbabilities {

	public ProbEx1(int[] observation) {
		this.observation = observation;
	}

	@Override
	public double transitionProb(int k, int l, int i) {
		if(l == 0) {
			if(k == 0) { return 0.6; }
			return 0.4;
		}
		if(k == 0) { return 0.2; }
		return 0.8;
	}

	@Override
	public double observationProb(int state, int observationIndex) {
		int observation = this.observation[observationIndex];
		if(state == 0) {
			if(observation == 0) { return 0.6; }
			return 0.4;
		}
		if(observation == 0) { return 0.1; }
		return 0.9;
	}
	
	private int[] observation; 
}
